<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>点击倒计时的效果</title>
    <script>
        window.onload = function () {
            var button = document.getElementsByTagName("button")[0];
            button.onclick = function () {
                this.disabled = true;
                var obj = this;
                var num = 5;
                var timmer = setInterval(function () {
                    num--;
                    obj.innerHTML = num+"秒后重新发送";
                    if (num < 0){
                        clearInterval(timmer);
                        obj.innerHTML = "点击获取验证码";
                        obj.disabled = false;
                    }
                },1000);

            }
        }
    </script>
</head>
<body>
<input type="text"><button>点击获取验证码</button>
</body>
</html>